#!/usr/bin/env node
//const fs = require('fs')
//const lnk = process.argv[2];

//// src是指向
//const src = fs.readlinkSync(lnk)
//console.log(`${lnk} -> ${src}`);


const fs  = require('fs'),
      lnk = process.argv[2];

if(typeof(lnk) === 'undefined' || process.argv.length !== 3) {
    console.error('命令行参数不正确!');
    process.exit(1);
}

try{
    const src = fs.readlinkSync(lnk);
    console.log(`${lnk}->${src}`);
} catch(err) {
    console.error(err.message);
    process.exit(2);
}
